package com.itheima.servlet;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/demo13")
public class ServletDemo13 extends HttpServlet {
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        System.out.println("执行demo13");
        //获取作用域数据
        Object username = getServletContext().getAttribute("username");
        System.out.println(username);
        //获取请求域对象数据
        //重定向跳转页面
        resp.sendRedirect(req.getContextPath()+"/success.html");

    }
}
